package com.wedata.中台服务;

import cn.hutool.crypto.digest.MD5;
import cn.hutool.json.JSONObject;
import com.wedata.HttpUtils;

/**
 * 腾讯云tpns
 */
public class MessageCenterTpns {

    public static void main() {
        //String uri = "https://wedata.gymcity.com.cn/message/tpns/accountQuery";
        //String uri = "https://wedata.gymcity.com.cn/message/tpns/accountQuery";
        //JSONObject body = new JSONObject("{\"route\":\"btw-android\",\"accountQueryRequest\":{\"account_list\":[{\"account\":\"betterwe_1331216\",\"account_type\":0},{\"account\":\"betterwe_1338279\",\"account_type\":0}],\"operator_type\":1,\"token_list\":[]}}");

        String uri = "http://192.168.0.142:8085/message/tpns/package/upload";
        //String uri = "https://twedata.gymcity.com.cn/message/tpns/package/upload";
        JSONObject body = new JSONObject("{\"route\":\"btw-android\",\"accountPrefix\":\"betterwe_\",\"filePath\":\"https://cdnvue.gymcity.com.cn/datacenter/tpns/package/52.txt\",\"taskId\":1}");

        /*String sign = MD5.create().digestHex(body+"#270ad09ccbec217ffe120a8550f61c12");
        JSONObject header = new JSONObject("{\"X-TRACEID\":\"uuid\",\"X-APPKEY\":\"17600048054\",\"X-SIGN\":\""+sign+"\"}");*/

        String sign = MD5.create().digestHex(body+"#270ad09cbecc217ffe120a8550f61c12");
        JSONObject header = new JSONObject("{\"X-TRACEID\":\"uuid\",\"X-APPKEY\":\"12700048053\",\"X-SIGN\":\""+sign+"\"}");



        Long s = System.currentTimeMillis();
        System.out.println(HttpUtils.sendPost(uri,header,body)+":"+(System.currentTimeMillis()-s));

        //{"code":0,"msg":null,"data":5592542,"time":1700449528}:7452

        //{"code":0,"msg":null,"data":5592546,"time":1700449675}:2169

        //{"code":0,"msg":null,"data":5592550,"time":1700449918}:707

    }

    public static void main(String[] args) {
        String uri = "https://tucenter.gymcity.com.cn/ucenter/user/getUcenterUserByMobile";
        JSONObject body = new JSONObject("{\"areacode\":86,\"mobile\":\"18670715634\"}");
        System.out.println(body+"#cd518d961d0e08c4e6f0151ca09a523d");
        String sign = MD5.create().digestHex(body+"#uy87s9af0b6c3c88971b83812e4a45y1");
        System.out.println(sign);
        JSONObject header = new JSONObject("{\"X-TRACEID\":\"uuid\",\"X-APPKEY\":\"12486035793\",\"X-SIGN\":\""+sign+"\"}");
        Long s = System.currentTimeMillis();
        System.out.println(HttpUtils.sendPost(uri,header,body)+":"+(System.currentTimeMillis()-s));
    }
}
